﻿@using OpenIdProvider
@model OpenIdProvider.Models.User
@{
    Layout = null;
    Response.AddHeader("Content-Type", "application/xrds+xml");
}
<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS
	xmlns:xrds="xri://$xrds"
	xmlns:openid="http://openid.net/xmlns/1.0"
	xmlns="xri://$xrd*($v*2.0)">
	<XRD>
		<Service priority="10">
        @if (ViewData.ContainsKey("OPIdentifier"))
        {
			<Type>http://specs.openid.net/auth/2.0/server</Type>
        }
        else
        {
			<Type>http://specs.openid.net/auth/2.0/signon</Type>
            if (Model != null)
            {
                <LocalID>@Model.GetClaimedIdentifier()</LocalID>
            }
        }
			<Type>http://openid.net/extensions/sreg/1.1</Type>
			<Type>http://axschema.org/contact/email</Type>
			
			@*
			Add these types when and if the Provider supports the respective aspects of the UI extension.
			<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>
			<Type>http://specs.openid.net/extensions/ui/1.0/lang-pref</Type>
			<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>
            *@

			<URI>@(new Uri(Current.RequestUri, Response.ApplyAppPathModifier("~/openid/provider")))</URI>
		</Service>
        @if (!ViewData.ContainsKey("OPIdentifier"))
        {
		    <Service priority="20">
			    <Type>http://openid.net/signon/1.0</Type>
			    <Type>http://openid.net/extensions/sreg/1.1</Type>
			    <Type>http://axschema.org/contact/email</Type>
			    <URI>@(new Uri(Current.RequestUri, Response.ApplyAppPathModifier("~/openid/provider")))</URI>
		    </Service>
        }
	</XRD>
</xrds:XRDS>